package de.ret_world.eet.view;

import de.ret_world.eet.code.CodeTable;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Emu
 */
public class CodeTableModel extends AbstractTableModel {

    private final CodeTable table;

    public CodeTableModel(CodeTable table) {
        this.table = table;
    }

    @Override
    public int getRowCount() {
        return table.getTableSize();
    }

    @Override
    public int getColumnCount() {
        return table.getTableSize();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return table.getSymbol(columnIndex, rowIndex);
    }

    @Override
    public String getColumnName(int column) {
        List lst = new ArrayList(table.getAlphabet().getSymbols());
        return lst.get(column).toString();
    }
}
